//
//  ApproveTableViewCell.m
//  ZJControlsClass
//
//  Created by apple on 2024/10/25.
//

#import "ApproveTableViewCell.h"

@implementation ApproveTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.backgroundColor = COLOR_RGB(243, 243, 243);
        [self configUI];
        
        
    }
    return self;
}

-(void)configUI{
    [self.contentView addSubview:self.follewView];
    [self.follewView addSubview:self.titleLabel];
    [self.follewView addSubview:self.personLabel];
    [self.follewView addSubview:self.unitLabel];
    [self.follewView addSubview:self.v];
    [self.follewView addSubview:self.timeLabel];
    [self.follewView addSubview:self.statusLabel];
    
    [self.follewView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(@(ALIGN_WIDTH_PT(10)));
        make.right.bottom.equalTo(@(-ALIGN_HEIGHT_PT(10)));
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(self.follewView).with.offset(ALIGN_WIDTH_PT(10));
        make.height.equalTo(@(ALIGN_HEIGHT_PT(30)));
        make.right.equalTo(self.follewView).with.offset(-ALIGN_WIDTH_PT(10));
    }];
    
    [self.personLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLabel.mas_bottom).with.offset(ALIGN_WIDTH_PT(10));
        make.left.equalTo(self.titleLabel.mas_left);
        make.height.equalTo(@(ALIGN_HEIGHT_PT(20)));
        make.right.equalTo(self.follewView).with.offset(-ALIGN_WIDTH_PT(10));
    }];
    
    [self.unitLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.personLabel.mas_bottom).with.offset(ALIGN_WIDTH_PT(10));
        make.left.equalTo(self.titleLabel.mas_left);
        make.height.equalTo(@(ALIGN_HEIGHT_PT(20)));
        make.right.equalTo(self.follewView).with.offset(-ALIGN_WIDTH_PT(10));
    }];
    
    [self.v mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.unitLabel.mas_bottom).with.offset(ALIGN_WIDTH_PT(10));
        make.left.equalTo(self.titleLabel.mas_left);
        make.height.equalTo(@(ALIGN_HEIGHT_PT(1)));
        make.right.equalTo(self.follewView).with.offset(-ALIGN_WIDTH_PT(10));
    }];
    
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.v.mas_bottom).with.offset(ALIGN_WIDTH_PT(10));
        make.left.equalTo(self.titleLabel.mas_left);
        make.height.equalTo(@(ALIGN_HEIGHT_PT(20)));
    }];
    
    [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.timeLabel.mas_centerY);
        make.height.equalTo(@(ALIGN_HEIGHT_PT(20)));
        make.right.equalTo(self.follewView).with.offset(-ALIGN_WIDTH_PT(20));
    }];
    
    
}


-(void)setModel:(ZJPendApprovallToDoListModel *)model{

    _model = model;
    self.titleLabel.text = [NSString stringWithFormat:@"%@",_model.processDefinitionName];
    self.personLabel.text = [NSString stringWithFormat:@"申请人员：%@",_model.startUser.name];
    self.unitLabel.text = [NSString stringWithFormat:@"申请公司：%@",_model.startUser.companyName];
    self.timeLabel.text = [NSString stringWithFormat:@"%@",_model.startTime];
    
    self.statusLabel.text = model.currentActivityName;
    
    
//    if ([_model.businessStatus intValue] == 1){
//        self.statusLabel.text = @"正在处理";
//        self.statusLabel.textColor = COLOR_RGB(50, 113, 237);
//    }else if ([_model.businessStatus intValue] == 2){
//        self.statusLabel.text = @"撤销";
//        self.statusLabel.textColor = [UIColor orangeColor];
//    }else if ([_model.businessStatus intValue] == 3){
//        self.statusLabel.text = @"驳回";
//        self.statusLabel.textColor = [UIColor redColor];
//    }else if ([_model.businessStatus intValue] == 4){
//        self.statusLabel.text = @"已结束";
//        self.statusLabel.textColor = [UIColor greenColor];
//    }
    
}




#pragma mark -- 懒加载
-(UIView *)follewView{
    if (!_follewView) {
        _follewView = [UIView new];
        _follewView.backgroundColor = [UIColor whiteColor];
        _follewView.layer.cornerRadius = 8;
        _follewView.layer.masksToBounds = YES;
    }
    return _follewView;
}

-(UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [UILabel new];
        _titleLabel.textAlignment = NSTextAlignmentLeft;
        _titleLabel.font = FONT16;
        _titleLabel.text = @"临时通行证申办";
        _titleLabel.textColor = [UIColor blackColor];
    }
    return _titleLabel;
}

-(UILabel *)personLabel{
    if (!_personLabel) {
        _personLabel = [UILabel new];
        _personLabel.textAlignment = NSTextAlignmentLeft;
        _personLabel.font = FONT14;
        _personLabel.text = @"申请人员：赵庄镇";
        _personLabel.textColor = [UIColor blackColor];
    }
    return _personLabel;
}

-(UILabel *)unitLabel{
    if (!_unitLabel) {
        _unitLabel = [UILabel new];
        _unitLabel.textAlignment = NSTextAlignmentLeft;
        _unitLabel.font = FONT14;
        _unitLabel.text = @"申请单位：机场超市分公司";
        _unitLabel.textColor = [UIColor blackColor];
    }
    return _unitLabel;
}

-(UIView *)v{
    if (!_v) {
        _v = [UIView new];
        _v.backgroundColor = COLOR_RGB(228, 228, 228);
    }
    return _v;
}

-(UILabel *)timeLabel{
    if (!_timeLabel) {
        _timeLabel = [UILabel new];
        _timeLabel.textAlignment = NSTextAlignmentLeft;
        _timeLabel.font = FONT14;
        _timeLabel.text = @"2024.05.12 12:36";
        _timeLabel.textColor = COLOR_RGB(153, 153, 153);
    }
    return _timeLabel;
}

-(UILabel *)statusLabel{
    if (!_statusLabel) {
        _statusLabel = [UILabel new];
        _statusLabel.textAlignment = NSTextAlignmentLeft;
        _statusLabel.font = FONT14;
        _statusLabel.text = @"考试合格";
        _statusLabel.textColor = [UIColor blackColor];
    }
    return _statusLabel;
}




@end
